<%
dim ComeUrl,cUrl

ComeUrl=lcase(trim(request.ServerVariables("HTTP_REFERER")))
if ComeUrl="" then
	response.write "<br><p align=center><font color='red'>对不起，为了系统安全，不允许直接输入地址访问本系统的后台管理页面。</font></p>"
	response.end
else
	cUrl=trim("http://" & Request.ServerVariables("SERVER_NAME"))
	if mid(ComeUrl,len(cUrl)+1,1)=":" then
		cUrl=cUrl & ":" & Request.ServerVariables("SERVER_PORT")
	end if
	cUrl=lcase(cUrl & request.ServerVariables("SCRIPT_NAME"))
end if

if session("SYSUserID")<>"" then
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from Admin_lt_jt_wjk where admin_Pwd_wjk='"&replace(session("SYSPwd"),"'","")&"' and admin_User_wjk='"&replace(session("SYSUser"),"'","")&"' "
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		response.Write("<script>alert('Error: Please Sign in.');parent.location='login.asp';</script>")
		response.End()
	else
		LoginTimes=rs("admin_logins")
		admin_now_login_time=rs("admin_now_login_time")
		admin_last_login_time=rs("admin_last_login_time")
		admin_now_login_ip=rs("admin_now_login_ip")	
		admin_last_login_ip=rs("admin_last_login_ip")
		idcount=rs(0)
	end if
	rs.close
	set rs=nothing
else
	response.Write("<script>alert('Error: Please Sign in.');parent.location='login.asp';</script>")
	response.End()
end if


'系统配置信息加载
set rscon=server.CreateObject("adodb.recordset")
sqlcon="select * from Admin_Setting where ID=1"
rscon.open sqlcon,conn,1,1
	'文章设置选项
	NImage_con=rscon("NImage")
	NewsSubtitle_con=rscon("NewsSubtitle")
	Newspic_con=rscon("Newspic")
	NewsClassIntro_con=rscon("NewsClassIntro")
	NewsClassPic_con=rscon("NewsClassPic")
	NewsClassSD_con=rscon("NewsClassSD")
	NewsPxMethod_con=rscon("NewsPxMethod")
	PImage_con=rscon("PImage")
	Support_con=rscon("Support")
	ProductPic_con=rscon("ProductPic")
	ProductBigPic_con=rscon("ProductBigPic")
	ProductIntro_con=rscon("ProductIntro")
	ProductClassIntro_con=rscon("ProductClassIntro")
	ProductClassPic_con=rscon("ProductClassPic")
	ProductClassSD_con=rscon("ProductClassSD")
	ProductPxMethod_con=rscon("ProductPxMethod")
	'登入设置
	SessionTimeout_con=rscon("SessionTimeout")
	'上传设置选项
	EnableUploadFile_con=rscon("EnableUploadFile")
	UploadApp_con=rscon("UploadApp")
	MaxUpFileSize_con=rscon("MaxUpFileSize")
	UpFileType_con=rscon("UpFileType")
	UploadSavePath_con=rscon("UploadSavePath")
	CreateDateFloder_con=rscon("CreateDateFloder")
	DelUpFiles_con=rscon("DelUpFiles")
	'图片处理设置选项
	Watermark_con=rscon("Watermark")
	WatermarkApp_con=rscon("WatermarkApp")
	ThumbImage_con=rscon("ThumbImage")
	ThumbImageMaxWidth_con=rscon("ThumbImageMaxWidth")
	ThumbImageMaxHeight_con=rscon("ThumbImageMaxHeight")
	WatermarkAddBd_con=rscon("WatermarkAddBd")
	WatermarkBdWidth_con=rscon("WatermarkBdWidth")
	WatermarkBdColor_con=rscon("WatermarkBdColor")
	WatermarkType_con=rscon("WatermarkType")
	WatermarkText_con=rscon("WatermarkText")
	WatermarkTextFontFamily_con=rscon("WatermarkTextFontFamily")
	WatermarkTextFontSize_con=rscon("WatermarkTextFontSize")
	WatermarkTextColor_con=rscon("WatermarkTextColor")
	WatermarkTextOpacity_con=rscon("WatermarkTextOpacity")
	WatermarkPic_con=rscon("WatermarkPic")
	WatermarkBigPic_con=rscon("WatermarkBigPic")
	WatermarkLocal_con=rscon("WatermarkLocal")
	WatermarkPadingX_con=rscon("WatermarkPadingX")
	WatermarkPadingY_con=rscon("WatermarkPadingY")
	'邮件设置选项
	MailSend_con=rscon("MailSend")
	MailSendApp_con=rscon("MailSendApp")
rscon.close
set rscon=nothing
if SessionTimeout_con>0 then session.Timeout=SessionTimeout_con

'邮件配置信息加载
set rs=server.CreateObject("adodb.recordset")
sql="select * from Mail_Setting where ID=1"
rs.open sql,conn,1,1
Mailhostserver_con = rs("Mailhostserver")
MailUser_con = rs("MailUser")
MailPwd_con = rs("MailPwd")
MailSMTP_con = rs("MailSMTP")
MailPort_con = rs("MailPort")
MailTLS_con = rs("MailTLS")
MailAccept_con = rs("MailAccept")
MailOpen_con = rs("MailOpen")
rs.close
set rs=nothing


sub adminRight(num)
	arrSysRight=split(session("SYSRight"),"|")
	if num>ubound(arrSysRight) then
		alert("Error: 超出数组下标。")
		Go("main.asp")
		response.End()
	else
		if cInt(arrSysRight(num))=0 then
			alert("对不起，您没有访问该页面的权限，请与管理员联系！")
			Go("main.asp")
			response.End()
		end if
	end if
end sub

if request("showMsgStr")<>"" then
 arrMsgStr=split(request("showMsgStr"),"|")
 call ShowMessage(arrMsgStr(0),arrMsgStr(1),arrMsgStr(2),arrMsgStr(3),arrMsgStr(4),arrMsgStr(5))
 'msgContent,target,keepTime,delayTime,width,height
end if
%>